package com.study.system.course.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.study.system.course.mapper.CourseOrientationMapper;
import com.study.system.course.service.CourseOrientationService;
import com.study.system.entity.CourseOrientation;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseOrientationServiceImpl extends ServiceImpl<CourseOrientationMapper, CourseOrientation>
implements CourseOrientationService {

    @Resource
    private CourseOrientationMapper mapper;

    @Override
    public List<CourseOrientation> getParentCourseOrientations() {
        List<CourseOrientation> orientations = mapper.selectList(
                new QueryWrapper<CourseOrientation>().lambda().eq(CourseOrientation::getParentId,0));
        return orientations;
    }

    @Override
    public List<CourseOrientation> getCourseOrientationsByParentId(Integer parentId) {
        List<CourseOrientation> orientations = mapper.selectList(
                new QueryWrapper<CourseOrientation>().lambda().eq(CourseOrientation::getParentId,parentId));
        return orientations;
    }
}
